﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using hsgsSHXX.DBUtility;//Please add references
using System.Collections.Generic;
namespace hsgsSHXX.DAL
{
	/// <summary>
	/// 数据访问类:mzrz
	/// </summary>
	public partial class mzrz
	{
		public mzrz()
		{}
		#region  Method



		/// <summary>
		/// 增加一条数据
		/// </summary>
		public bool Add(hsgsSHXX.Model.mzrz model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into mzrz(");
			strSql.Append("ID,brxm,mzblhm,jzsj,xb,nl,csrq,sfzh,zy,jzlx,lccbzd,fbrq,crb,mbbk,zlqk,lxdh,jzxm,szdw,dz,brqx,ys,ssy,szy,bz,tz,tw,mb,fbxx)");
			strSql.Append(" values (");
			strSql.Append("@ID,@brxm,@mzblhm,@jzsj,@xb,@nl,@csrq,@sfzh,@zy,@jzlx,@lccbzd,@fbrq,@crb,@mbbk,@zlqk,@lxdh,@jzxm,@szdw,@dz,@brqx,@ys,@ssy,@szy,@bz,@tz,@tw,@mb,@fbxx)");
			SqlParameter[] parameters = {
					new SqlParameter("@ID", SqlDbType.Int,4),
					new SqlParameter("@brxm", SqlDbType.NVarChar,255),
					new SqlParameter("@mzblhm", SqlDbType.NVarChar,255),
					new SqlParameter("@jzsj", SqlDbType.NVarChar,255),
					new SqlParameter("@xb", SqlDbType.NVarChar,255),
					new SqlParameter("@nl", SqlDbType.NVarChar,255),
					new SqlParameter("@csrq", SqlDbType.NVarChar,255),
					new SqlParameter("@sfzh", SqlDbType.NVarChar,255),
					new SqlParameter("@zy", SqlDbType.NVarChar,255),
					new SqlParameter("@jzlx", SqlDbType.NVarChar,255),
					new SqlParameter("@lccbzd", SqlDbType.NVarChar,255),
					new SqlParameter("@fbrq", SqlDbType.NVarChar,255),
					new SqlParameter("@crb", SqlDbType.NVarChar,255),
					new SqlParameter("@mbbk", SqlDbType.NVarChar,255),
					new SqlParameter("@zlqk", SqlDbType.NVarChar,255),
					new SqlParameter("@lxdh", SqlDbType.NVarChar,255),
					new SqlParameter("@jzxm", SqlDbType.NVarChar,255),
					new SqlParameter("@szdw", SqlDbType.NVarChar,255),
					new SqlParameter("@dz", SqlDbType.NVarChar,255),
					new SqlParameter("@brqx", SqlDbType.NVarChar,255),
					new SqlParameter("@ys", SqlDbType.NVarChar,255),
					new SqlParameter("@ssy", SqlDbType.NVarChar,255),
					new SqlParameter("@szy", SqlDbType.NVarChar,255),
					new SqlParameter("@bz", SqlDbType.NVarChar,255),
					new SqlParameter("@tz", SqlDbType.NVarChar,255),
					new SqlParameter("@tw", SqlDbType.NVarChar,255),
					new SqlParameter("@mb", SqlDbType.NVarChar,255),
					new SqlParameter("@fbxx", SqlDbType.NVarChar,255)};
			parameters[0].Value = model.ID;
			parameters[1].Value = model.brxm;
			parameters[2].Value = model.mzblhm;
			parameters[3].Value = model.jzsj;
			parameters[4].Value = model.xb;
			parameters[5].Value = model.nl;
			parameters[6].Value = model.csrq;
			parameters[7].Value = model.sfzh;
			parameters[8].Value = model.zy;
			parameters[9].Value = model.jzlx;
			parameters[10].Value = model.lccbzd;
			parameters[11].Value = model.fbrq;
			parameters[12].Value = model.crb;
			parameters[13].Value = model.mbbk;
			parameters[14].Value = model.zlqk;
			parameters[15].Value = model.lxdh;
			parameters[16].Value = model.jzxm;
			parameters[17].Value = model.szdw;
			parameters[18].Value = model.dz;
			parameters[19].Value = model.brqx;
			parameters[20].Value = model.ys;
			parameters[21].Value = model.ssy;
			parameters[22].Value = model.szy;
			parameters[23].Value = model.bz;
			parameters[24].Value = model.tz;
			parameters[25].Value = model.tw;
			parameters[26].Value = model.mb;
			parameters[27].Value = model.fbxx;

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(hsgsSHXX.Model.mzrz model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update mzrz set ");
			strSql.Append("ID=@ID,");
			strSql.Append("brxm=@brxm,");
			strSql.Append("mzblhm=@mzblhm,");
			strSql.Append("jzsj=@jzsj,");
			strSql.Append("xb=@xb,");
			strSql.Append("nl=@nl,");
			strSql.Append("csrq=@csrq,");
			strSql.Append("sfzh=@sfzh,");
			strSql.Append("zy=@zy,");
			strSql.Append("jzlx=@jzlx,");
			strSql.Append("lccbzd=@lccbzd,");
			strSql.Append("fbrq=@fbrq,");
			strSql.Append("crb=@crb,");
			strSql.Append("mbbk=@mbbk,");
			strSql.Append("zlqk=@zlqk,");
			strSql.Append("lxdh=@lxdh,");
			strSql.Append("jzxm=@jzxm,");
			strSql.Append("szdw=@szdw,");
			strSql.Append("dz=@dz,");
			strSql.Append("brqx=@brqx,");
			strSql.Append("ys=@ys,");
			strSql.Append("ssy=@ssy,");
			strSql.Append("szy=@szy,");
			strSql.Append("bz=@bz,");
			strSql.Append("tz=@tz,");
			strSql.Append("tw=@tw,");
			strSql.Append("mb=@mb,");
			strSql.Append("fbxx=@fbxx");
			strSql.Append(" where ");
			SqlParameter[] parameters = {
					new SqlParameter("@ID", SqlDbType.Int,4),
					new SqlParameter("@brxm", SqlDbType.NVarChar,255),
					new SqlParameter("@mzblhm", SqlDbType.NVarChar,255),
					new SqlParameter("@jzsj", SqlDbType.NVarChar,255),
					new SqlParameter("@xb", SqlDbType.NVarChar,255),
					new SqlParameter("@nl", SqlDbType.NVarChar,255),
					new SqlParameter("@csrq", SqlDbType.NVarChar,255),
					new SqlParameter("@sfzh", SqlDbType.NVarChar,255),
					new SqlParameter("@zy", SqlDbType.NVarChar,255),
					new SqlParameter("@jzlx", SqlDbType.NVarChar,255),
					new SqlParameter("@lccbzd", SqlDbType.NVarChar,255),
					new SqlParameter("@fbrq", SqlDbType.NVarChar,255),
					new SqlParameter("@crb", SqlDbType.NVarChar,255),
					new SqlParameter("@mbbk", SqlDbType.NVarChar,255),
					new SqlParameter("@zlqk", SqlDbType.NVarChar,255),
					new SqlParameter("@lxdh", SqlDbType.NVarChar,255),
					new SqlParameter("@jzxm", SqlDbType.NVarChar,255),
					new SqlParameter("@szdw", SqlDbType.NVarChar,255),
					new SqlParameter("@dz", SqlDbType.NVarChar,255),
					new SqlParameter("@brqx", SqlDbType.NVarChar,255),
					new SqlParameter("@ys", SqlDbType.NVarChar,255),
					new SqlParameter("@ssy", SqlDbType.NVarChar,255),
					new SqlParameter("@szy", SqlDbType.NVarChar,255),
					new SqlParameter("@bz", SqlDbType.NVarChar,255),
					new SqlParameter("@tz", SqlDbType.NVarChar,255),
					new SqlParameter("@tw", SqlDbType.NVarChar,255),
					new SqlParameter("@mb", SqlDbType.NVarChar,255),
					new SqlParameter("@fbxx", SqlDbType.NVarChar,255)};
			parameters[0].Value = model.ID;
			parameters[1].Value = model.brxm;
			parameters[2].Value = model.mzblhm;
			parameters[3].Value = model.jzsj;
			parameters[4].Value = model.xb;
			parameters[5].Value = model.nl;
			parameters[6].Value = model.csrq;
			parameters[7].Value = model.sfzh;
			parameters[8].Value = model.zy;
			parameters[9].Value = model.jzlx;
			parameters[10].Value = model.lccbzd;
			parameters[11].Value = model.fbrq;
			parameters[12].Value = model.crb;
			parameters[13].Value = model.mbbk;
			parameters[14].Value = model.zlqk;
			parameters[15].Value = model.lxdh;
			parameters[16].Value = model.jzxm;
			parameters[17].Value = model.szdw;
			parameters[18].Value = model.dz;
			parameters[19].Value = model.brqx;
			parameters[20].Value = model.ys;
			parameters[21].Value = model.ssy;
			parameters[22].Value = model.szy;
			parameters[23].Value = model.bz;
			parameters[24].Value = model.tz;
			parameters[25].Value = model.tw;
			parameters[26].Value = model.mb;
			parameters[27].Value = model.fbxx;

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete()
		{
			//该表无主键信息，请自定义主键/条件字段
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from mzrz ");
			strSql.Append(" where ");
			SqlParameter[] parameters = {
};

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public hsgsSHXX.Model.mzrz GetModel()
		{
			//该表无主键信息，请自定义主键/条件字段
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 ID,brxm,mzblhm,jzsj,xb,nl,csrq,sfzh,zy,jzlx,lccbzd,fbrq,crb,mbbk,zlqk,lxdh,jzxm,szdw,dz,brqx,ys,ssy,szy,bz,tz,tw,mb,fbxx from mzrz ");
			strSql.Append(" where ");
			SqlParameter[] parameters = {
};

			hsgsSHXX.Model.mzrz model=new hsgsSHXX.Model.mzrz();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			if(ds.Tables[0].Rows.Count>0)
			{
				if(ds.Tables[0].Rows[0]["ID"]!=null && ds.Tables[0].Rows[0]["ID"].ToString()!="")
				{
					model.ID=int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
				}
				if(ds.Tables[0].Rows[0]["brxm"]!=null && ds.Tables[0].Rows[0]["brxm"].ToString()!="")
				{
					model.brxm=ds.Tables[0].Rows[0]["brxm"].ToString();
				}
				if(ds.Tables[0].Rows[0]["mzblhm"]!=null && ds.Tables[0].Rows[0]["mzblhm"].ToString()!="")
				{
					model.mzblhm=ds.Tables[0].Rows[0]["mzblhm"].ToString();
				}
				if(ds.Tables[0].Rows[0]["jzsj"]!=null && ds.Tables[0].Rows[0]["jzsj"].ToString()!="")
				{
					model.jzsj=ds.Tables[0].Rows[0]["jzsj"].ToString();
				}
				if(ds.Tables[0].Rows[0]["xb"]!=null && ds.Tables[0].Rows[0]["xb"].ToString()!="")
				{
					model.xb=ds.Tables[0].Rows[0]["xb"].ToString();
				}
				if(ds.Tables[0].Rows[0]["nl"]!=null && ds.Tables[0].Rows[0]["nl"].ToString()!="")
				{
					model.nl=ds.Tables[0].Rows[0]["nl"].ToString();
				}
				if(ds.Tables[0].Rows[0]["csrq"]!=null && ds.Tables[0].Rows[0]["csrq"].ToString()!="")
				{
					model.csrq=ds.Tables[0].Rows[0]["csrq"].ToString();
				}
				if(ds.Tables[0].Rows[0]["sfzh"]!=null && ds.Tables[0].Rows[0]["sfzh"].ToString()!="")
				{
					model.sfzh=ds.Tables[0].Rows[0]["sfzh"].ToString();
				}
				if(ds.Tables[0].Rows[0]["zy"]!=null && ds.Tables[0].Rows[0]["zy"].ToString()!="")
				{
					model.zy=ds.Tables[0].Rows[0]["zy"].ToString();
				}
				if(ds.Tables[0].Rows[0]["jzlx"]!=null && ds.Tables[0].Rows[0]["jzlx"].ToString()!="")
				{
					model.jzlx=ds.Tables[0].Rows[0]["jzlx"].ToString();
				}
				if(ds.Tables[0].Rows[0]["lccbzd"]!=null && ds.Tables[0].Rows[0]["lccbzd"].ToString()!="")
				{
					model.lccbzd=ds.Tables[0].Rows[0]["lccbzd"].ToString();
				}
				if(ds.Tables[0].Rows[0]["fbrq"]!=null && ds.Tables[0].Rows[0]["fbrq"].ToString()!="")
				{
					model.fbrq=ds.Tables[0].Rows[0]["fbrq"].ToString();
				}
				if(ds.Tables[0].Rows[0]["crb"]!=null && ds.Tables[0].Rows[0]["crb"].ToString()!="")
				{
					model.crb=ds.Tables[0].Rows[0]["crb"].ToString();
				}
				if(ds.Tables[0].Rows[0]["mbbk"]!=null && ds.Tables[0].Rows[0]["mbbk"].ToString()!="")
				{
					model.mbbk=ds.Tables[0].Rows[0]["mbbk"].ToString();
				}
				if(ds.Tables[0].Rows[0]["zlqk"]!=null && ds.Tables[0].Rows[0]["zlqk"].ToString()!="")
				{
					model.zlqk=ds.Tables[0].Rows[0]["zlqk"].ToString();
				}
				if(ds.Tables[0].Rows[0]["lxdh"]!=null && ds.Tables[0].Rows[0]["lxdh"].ToString()!="")
				{
					model.lxdh=ds.Tables[0].Rows[0]["lxdh"].ToString();
				}
				if(ds.Tables[0].Rows[0]["jzxm"]!=null && ds.Tables[0].Rows[0]["jzxm"].ToString()!="")
				{
					model.jzxm=ds.Tables[0].Rows[0]["jzxm"].ToString();
				}
				if(ds.Tables[0].Rows[0]["szdw"]!=null && ds.Tables[0].Rows[0]["szdw"].ToString()!="")
				{
					model.szdw=ds.Tables[0].Rows[0]["szdw"].ToString();
				}
				if(ds.Tables[0].Rows[0]["dz"]!=null && ds.Tables[0].Rows[0]["dz"].ToString()!="")
				{
					model.dz=ds.Tables[0].Rows[0]["dz"].ToString();
				}
				if(ds.Tables[0].Rows[0]["brqx"]!=null && ds.Tables[0].Rows[0]["brqx"].ToString()!="")
				{
					model.brqx=ds.Tables[0].Rows[0]["brqx"].ToString();
				}
				if(ds.Tables[0].Rows[0]["ys"]!=null && ds.Tables[0].Rows[0]["ys"].ToString()!="")
				{
					model.ys=ds.Tables[0].Rows[0]["ys"].ToString();
				}
				if(ds.Tables[0].Rows[0]["ssy"]!=null && ds.Tables[0].Rows[0]["ssy"].ToString()!="")
				{
					model.ssy=ds.Tables[0].Rows[0]["ssy"].ToString();
				}
				if(ds.Tables[0].Rows[0]["szy"]!=null && ds.Tables[0].Rows[0]["szy"].ToString()!="")
				{
					model.szy=ds.Tables[0].Rows[0]["szy"].ToString();
				}
				if(ds.Tables[0].Rows[0]["bz"]!=null && ds.Tables[0].Rows[0]["bz"].ToString()!="")
				{
					model.bz=ds.Tables[0].Rows[0]["bz"].ToString();
				}
				if(ds.Tables[0].Rows[0]["tz"]!=null && ds.Tables[0].Rows[0]["tz"].ToString()!="")
				{
					model.tz=ds.Tables[0].Rows[0]["tz"].ToString();
				}
				if(ds.Tables[0].Rows[0]["tw"]!=null && ds.Tables[0].Rows[0]["tw"].ToString()!="")
				{
					model.tw=ds.Tables[0].Rows[0]["tw"].ToString();
				}
				if(ds.Tables[0].Rows[0]["mb"]!=null && ds.Tables[0].Rows[0]["mb"].ToString()!="")
				{
					model.mb=ds.Tables[0].Rows[0]["mb"].ToString();
				}
				if(ds.Tables[0].Rows[0]["fbxx"]!=null && ds.Tables[0].Rows[0]["fbxx"].ToString()!="")
				{
					model.fbxx=ds.Tables[0].Rows[0]["fbxx"].ToString();
				}
				return model;
			}
			else
			{
				return null;
			}
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ID,brxm,mzblhm,jzsj,xb,nl,csrq,sfzh,zy,jzlx,lccbzd,fbrq,crb,mbbk,zlqk,lxdh,jzxm,szdw,dz,brqx,ys,ssy,szy,bz,tz,tw,mb,fbxx ");
			strSql.Append(" FROM mzrz ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ");
			if(Top>0)
			{
				strSql.Append(" top "+Top.ToString());
			}
			strSql.Append(" ID,brxm,mzblhm,jzsj,xb,nl,csrq,sfzh,zy,jzlx,lccbzd,fbrq,crb,mbbk,zlqk,lxdh,jzxm,szdw,dz,brqx,ys,ssy,szy,bz,tz,tw,mb,fbxx ");
			strSql.Append(" FROM mzrz ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			strSql.Append(" order by " + filedOrder);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获取记录总数
		/// </summary>
		public int GetRecordCount(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) FROM mzrz ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			object obj = DbHelperSQL.GetSingle(strSql.ToString());
			if (obj == null)
			{
				return 0;
			}
			else
			{
				return Convert.ToInt32(obj);
			}
		}
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("SELECT * FROM ( ");
			strSql.Append(" SELECT ROW_NUMBER() OVER (");
			if (!string.IsNullOrEmpty(orderby.Trim()))
			{
				strSql.Append("order by T." + orderby );
			}
			else
			{
				strSql.Append("order by T. desc");
			}
			strSql.Append(")AS Row, T.*  from mzrz T ");
			if (!string.IsNullOrEmpty(strWhere.Trim()))
			{
				strSql.Append(" WHERE " + strWhere);
			}
			strSql.Append(" ) TT");
			strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/*
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		{
			SqlParameter[] parameters = {
					new SqlParameter("@tblName", SqlDbType.VarChar, 255),
					new SqlParameter("@fldName", SqlDbType.VarChar, 255),
					new SqlParameter("@PageSize", SqlDbType.Int),
					new SqlParameter("@PageIndex", SqlDbType.Int),
					new SqlParameter("@IsReCount", SqlDbType.Bit),
					new SqlParameter("@OrderType", SqlDbType.Bit),
					new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
					};
			parameters[0].Value = "mzrz";
			parameters[1].Value = "";
			parameters[2].Value = PageSize;
			parameters[3].Value = PageIndex;
			parameters[4].Value = 0;
			parameters[5].Value = 0;
			parameters[6].Value = strWhere;	
			return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
		}*/

		#endregion  Method
        public List<hsgsSHXX.Model.mzrz> DataTableToList(DataTable dt)
        {
            List<hsgsSHXX.Model.mzrz> modelList = new List<hsgsSHXX.Model.mzrz>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                hsgsSHXX.Model.mzrz model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new hsgsSHXX.Model.mzrz();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["brxm"] != null && dt.Rows[n]["brxm"].ToString() != "")
                    {
                        model.brxm = dt.Rows[n]["brxm"].ToString();
                    }
                    if (dt.Rows[n]["mzblhm"] != null && dt.Rows[n]["mzblhm"].ToString() != "")
                    {
                        model.mzblhm = dt.Rows[n]["mzblhm"].ToString();
                    }
                    if (dt.Rows[n]["jzsj"] != null && dt.Rows[n]["jzsj"].ToString() != "")
                    {
                        model.jzsj = dt.Rows[n]["jzsj"].ToString();
                    }
                    if (dt.Rows[n]["xb"] != null && dt.Rows[n]["xb"].ToString() != "")
                    {
                        model.xb = dt.Rows[n]["xb"].ToString();
                    }
                    if (dt.Rows[n]["nl"] != null && dt.Rows[n]["nl"].ToString() != "")
                    {
                        model.nl = dt.Rows[n]["nl"].ToString();
                    }
                    if (dt.Rows[n]["csrq"] != null && dt.Rows[n]["csrq"].ToString() != "")
                    {
                        model.csrq = dt.Rows[n]["csrq"].ToString();
                    }
                    if (dt.Rows[n]["sfzh"] != null && dt.Rows[n]["sfzh"].ToString() != "")
                    {
                        model.sfzh = dt.Rows[n]["sfzh"].ToString();
                    }
                    if (dt.Rows[n]["zy"] != null && dt.Rows[n]["zy"].ToString() != "")
                    {
                        model.zy = dt.Rows[n]["zy"].ToString();
                    }
                    if (dt.Rows[n]["jzlx"] != null && dt.Rows[n]["jzlx"].ToString() != "")
                    {
                        model.jzlx = dt.Rows[n]["jzlx"].ToString();
                    }
                    if (dt.Rows[n]["lccbzd"] != null && dt.Rows[n]["lccbzd"].ToString() != "")
                    {
                        model.lccbzd = dt.Rows[n]["lccbzd"].ToString();
                    }
                    if (dt.Rows[n]["fbrq"] != null && dt.Rows[n]["fbrq"].ToString() != "")
                    {
                        model.fbrq = dt.Rows[n]["fbrq"].ToString();
                    }
                    if (dt.Rows[n]["crb"] != null && dt.Rows[n]["crb"].ToString() != "")
                    {
                        model.crb = dt.Rows[n]["crb"].ToString();
                    }
                    if (dt.Rows[n]["mbbk"] != null && dt.Rows[n]["mbbk"].ToString() != "")
                    {
                        model.mbbk = dt.Rows[n]["mbbk"].ToString();
                    }
                    if (dt.Rows[n]["zlqk"] != null && dt.Rows[n]["zlqk"].ToString() != "")
                    {
                        model.zlqk = dt.Rows[n]["zlqk"].ToString();
                    }
                    if (dt.Rows[n]["lxdh"] != null && dt.Rows[n]["lxdh"].ToString() != "")
                    {
                        model.lxdh = dt.Rows[n]["lxdh"].ToString();
                    }
                    if (dt.Rows[n]["jzxm"] != null && dt.Rows[n]["jzxm"].ToString() != "")
                    {
                        model.jzxm = dt.Rows[n]["jzxm"].ToString();
                    }
                    if (dt.Rows[n]["szdw"] != null && dt.Rows[n]["szdw"].ToString() != "")
                    {
                        model.szdw = dt.Rows[n]["szdw"].ToString();
                    }
                    if (dt.Rows[n]["dz"] != null && dt.Rows[n]["dz"].ToString() != "")
                    {
                        model.dz = dt.Rows[n]["dz"].ToString();
                    }
                    if (dt.Rows[n]["brqx"] != null && dt.Rows[n]["brqx"].ToString() != "")
                    {
                        model.brqx = dt.Rows[n]["brqx"].ToString();
                    }
                    if (dt.Rows[n]["ys"] != null && dt.Rows[n]["ys"].ToString() != "")
                    {
                        model.ys = dt.Rows[n]["ys"].ToString();
                    }
                    if (dt.Rows[n]["ssy"] != null && dt.Rows[n]["ssy"].ToString() != "")
                    {
                        model.ssy = dt.Rows[n]["ssy"].ToString();
                    }
                    if (dt.Rows[n]["szy"] != null && dt.Rows[n]["szy"].ToString() != "")
                    {
                        model.szy = dt.Rows[n]["szy"].ToString();
                    }
                    if (dt.Rows[n]["bz"] != null && dt.Rows[n]["bz"].ToString() != "")
                    {
                        model.bz = dt.Rows[n]["bz"].ToString();
                    }
                    if (dt.Rows[n]["tz"] != null && dt.Rows[n]["tz"].ToString() != "")
                    {
                        model.tz = dt.Rows[n]["tz"].ToString();
                    }
                    if (dt.Rows[n]["tw"] != null && dt.Rows[n]["tw"].ToString() != "")
                    {
                        model.tw = dt.Rows[n]["tw"].ToString();
                    }
                    if (dt.Rows[n]["mb"] != null && dt.Rows[n]["mb"].ToString() != "")
                    {
                        model.mb = dt.Rows[n]["mb"].ToString();
                    }
                    if (dt.Rows[n]["fbxx"] != null && dt.Rows[n]["fbxx"].ToString() != "")
                    {
                        model.fbxx = dt.Rows[n]["fbxx"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return modelList;
        }
        public List<Model.mzrz> GetFondListByPage(int pageSize, int pageIndex, string strWhere, string fOrderFiled, out int total)
        {
            if (fOrderFiled == "")
            {
                fOrderFiled = "ID desc";
            }
            SqlParameter[] parameters = {  
                    new SqlParameter("@tableName", SqlDbType.VarChar, 50),  
                    new SqlParameter("@fields", SqlDbType.VarChar, 2000),  
                    new SqlParameter("@orderField", SqlDbType.VarChar, 500),  
                    new SqlParameter("@sqlWhere", SqlDbType.VarChar,2000),  
                    new SqlParameter("@pageSize", SqlDbType.Int),  
                    new SqlParameter("@pageIndex", SqlDbType.Int),  
                    new SqlParameter("@TotalPage", SqlDbType.Int),
                    new SqlParameter("@TotalRecordCount", SqlDbType.Int) 
                    };

            parameters[0].Value = "mzrz";
            parameters[1].Value = "*";
            parameters[2].Value = fOrderFiled;
            parameters[3].Value = strWhere;
            parameters[4].Value = pageSize;
            parameters[5].Value = pageIndex;
            parameters[6].Direction = ParameterDirection.Output;
            parameters[7].Direction = ParameterDirection.Output;
            DataSet ds = DbHelperSQL.RunProcedure("up_GetRecordByPage", parameters, "ds", 60 * 30);
            total = int.Parse(parameters[7].Value.ToString());
            return DataTableToList(ds.Tables[0]);

        }
	}
}

